<?php
include_once "ModelClass.php";
include_once "query.php";
include_once "consultasGrupos.php";
//----------------------------------------------------------------------

define("DATA_TABLENAME","pru_block_modulo_control_tutorial_data");
define("STRUCT_TABLENAME","pru_block_modulo_control_tutorial_structure");
define("ELEMENTS_TABLENAME","pru_block_modulo_control_tutorial_elements");

function conecta($dbhost,$dbusername,$dbpass,$database) {
    $link=DB::connect($dbhost,$dbusername,$dbpass);
    if (!$link) {
        die('Could not connect: ' . mysql_error());
        return FALSE;
    }
    if(!DB::select_db($database,$link)) {
        DB::close($link);
        die('Could not connect: ' . mysql_error());
        return FALSE;
    }
    return $link;
}

//----------------------------------------------------------------------

function reinicia() {
    $query= array(  'DROP TABLE pru_block_modulo_control_tutorial_data;',
            'DROP TABLE pru_block_modulo_control_tutorial_structure;',
            'DROP TABLE pru_block_modulo_control_tutorial_elements',
//Tabla estructura
            "CREATE TABLE pru_block_modulo_control_tutorial_structure (
            id INT(11) AUTO_INCREMENT PRIMARY KEY,
            value VARCHAR(100) NOT NULL,
            type VARCHAR(20) NOT NULL,
            lft INT(6) NOT NULL,
            rgt INT(6) NOT NULL
            );",
//Indice sobre value
            "CREATE UNIQUE INDEX IDX_STRUCT ON pru_block_modulo_control_tutorial_structure (value);",
//Tabla datos
            "CREATE TABLE pru_block_modulo_control_tutorial_data(
            id INT(11)NOT NULL,
            id_structure INT(11)NOT NULL,
            value VARCHAR(100)NOT NULL,
            PRIMARY KEY(id,id_structure),
            FOREIGN KEY (id_structure)
            REFERENCES pru_block_modulo_control_tutorial_structure(id),
            FOREIGN KEY (id)
            REFERENCES pru_block_modulo_control_tutorial_elements(id)
            );",

            "CREATE TABLE pru_block_modulo_control_tutorial_elements(
            type CHAR(20),
            id INT (11) AUTO_INCREMENT PRIMARY KEY ,
            name VARCHAR(50)
            );",
            "CREATE INDEX IDX_ELEMENTS ON pru_block_modulo_control_tutorial_elements(name) "
    );

    foreach ($query as $q) DB::query($q);

}
//----------------------------------------------------------------------

function creaEstructura($model,$debug) {
//RAIZ
// StructHandler::addChild('SISTEMA',"node","","");

//PRIMER NIVEL
    $model->addChild('USR',"element","","",$debug);
    $model->addChild('RSC',"element","","",$debug);
    $model->addChild('USR-RSC',"element#2","","",$debug);
    $model->addChild('GLO',"element","","",$debug);
    $model->addChild('SAL',"element","","",$debug);
    $model->addChild('SER',"element","","",$debug);
    $model->addChild('USR-GLO',"element#2","","",$debug);
    $model->addChild('USR-SAL',"element#2","","",$debug);
    $model->addChild('USR-SER',"element#2","","",$debug);

    $model->addChild('USR-RSC-GLO',"element#3","","",$debug);
    $model->addChild('USR-RSC-SAL',"element#3","","",$debug);
    $model->addChild('USR-RSC-SER',"element#3","","",$debug);
    $model->addChild('SAL-RSC-USR',"element#3","","",$debug);

    $model->addChild('USR-RSC-GLO-SAL',"element#4","","",$debug);
    $model->addChild('USR-RSC-GLO-SER',"element#4","","",$debug);
    $model->addChild('USR-RSC-SAL-SER',"element#4","","",$debug);
    $model->addChild('GLO-SAL-SER-USR',"element#4","","",$debug);

    $model->addChild('GLO-SAL-SER-USR-RSC',"element#5","","",$debug);

    $model->addChild('ATRIBUTO',"integer","/USR-RSC","",$debug);
    $model->addChild('ATRIBUTO',"integer","/USR-SAL","",$debug);
    $model->addChild('ATRIBUTO',"integer","/USR-SER","",$debug);
    $model->addChild('ATRIBUTO',"integer","/USR-GLO","",$debug);
    $model->addChild('ATRIBUTO',"integer","/USR-RSC-GLO","",$debug);
    $model->addChild('ATRIBUTO',"integer","/USR-RSC-SAL","",$debug);
    $model->addChild('ATRIBUTO',"integer","/USR-RSC-SER","",$debug);
    $model->addChild('ATRIBUTO',"integer","/SAL-RSC-USR","",$debug);
    $model->addChild('ATRIBUTO',"integer","/USR-RSC-GLO-SAL","",$debug);
    $model->addChild('ATRIBUTO',"integer","/USR-RSC-GLO-SER","",$debug);
    $model->addChild('ATRIBUTO',"integer","/USR-RSC-SAL-SER","",$debug);
    $model->addChild('ATRIBUTO',"integer","/GLO-SAL-SER-USR","",$debug);
    $model->addChild('ATRIBUTO',"integer","/GLO-SAL-SER-USR-RSC","",$debug);



//SEGUNDO NIVEL
    $model->addChild('LOGIN',"node","/USR","",$debug);
    $model->addChild('GESTION',"node","","/USR/LOGIN",$debug);
    $model->addChild('ACTIVIDAD',"node","","/USR/GESTION",$debug);


    $model->addChild('LOCALIZACION',"node","/RSC","",$debug);
    $model->addChild('CATEGORIZACION',"node","/RSC","",$debug);

    $model->addChild('NOTA',"integer","/USR-RSC","",$debug);
    $model->addChild('COMENTARIOS',"string","/USR-RSC","",$debug);

//TERCER NIVEL
    $model->addChild('USERNAME',"string","/USR/LOGIN","",$debug);
    $model->addChild('PASSWORD',"string","/USR/LOGIN","",$debug);

    $model->addChild('E_MAIL',"string","/USR/GESTION","",$debug);
    $model->addChild('NOMBRE_REAL',"string","/USR/GESTION","",$debug);

    $model->addChild('FECHA_REGISTRO',"date","/USR/ACTIVIDAD","",$debug);
    $model->addChild('ULTIMO_ACCESO',"date","/USR/ACTIVIDAD","",$debug);



    $model->addChild('PLATAFORMA',"string","/RSC/LOCALIZACION","",$debug);
    $model->addChild('ID_EXTERNO',"integer","/RSC/LOCALIZACION","",$debug);
    $model->addChild('ENTORNO_PROFESIONAL',"node","/RSC/CATEGORIZACION","",$debug);
    $model->addChild('ENTORNO_ACADEMICO',"node","/RSC/CATEGORIZACION","",$debug);

//CUARTO NIVEL


    $model->addChild('AMBITO_LABORAL',"string","/RSC/CATEGORIZACION/ENTORNO_PROFESIONAL","",$debug);
    $model->addChild('SECTOR',"string","/RSC/CATEGORIZACION/ENTORNO_PROFESIONAL","",$debug);
    $model->addChild('PUESTOS_DE_TRABAJO',"string","/RSC/CATEGORIZACION/ENTORNO_PROFESIONAL","",$debug);
    $model->addChild('NIVEL',"integer","/RSC/CATEGORIZACION/ENTORNO_ACADEMICO","",$debug);
    $model->addChild('AREA_DE_CONOCIMIENTO',"string","/RSC/CATEGORIZACION/ENTORNO_ACADEMICO","",$debug);






    return true;
}

//----------------------------------------------------------------------

function muestraArbol() {
    $result=DB::query("SELECT node.lft, node.rgt, node.type,CONCAT( REPEAT( '__', (COUNT(parent.value) - 1) ), node.value) AS value
    FROM pru_block_modulo_control_tutorial_structure AS node,
    pru_block_modulo_control_tutorial_structure AS parent
    WHERE node.lft BETWEEN parent.lft AND parent.rgt
    GROUP BY node.value
    ORDER BY node.lft;");

    while ($r1=DB::fetch_assoc($result)) {
        $fields= explode ('/',$r1['value']);
        $nc=count($fields);
        $n=array();
        for($i=0;$i<$nc-1;$i++) {
            $n[$i]=$fields[$i];
        }
        $n1=implode('/',$n);
        echo "<font color='#FF0000'>$n1</font>";
        echo "<font color='#0000CC'>/". $fields[$nc-1] ."</font>";
        echo "<font color='#339966'> ". $r1['type']."</font>";
        echo "<font color='#FF0000'> (".$r1['lft']."|".$r1['rgt'].") </font><BR>";
    }

}

// put your code here

//CONEXION A LA BASE DE DATOS
$dbhost="localhost";
$dbusername="root";
$dbpass="";
$database="pruebas";

$debug=false;
//OPCIONES:
$reiniciar=true; //Borrar y crear tablas
$reiniciarEstructura=true;
$probar=true; //a falso no se hace la parte del codigo a probar




//CONEXION A BASE DE DATOS
echo "1.-CONECTANDO A BASE DE DATOS ";
$link=conecta($dbhost,$dbusername,$dbpass,$database);
echo " | CONECTADO:<BR>";

//CREAR OBJETO MODEL(despues de conectar, antes de modificar)
echo "2.-CREANDO OBJETO MODEL ";
$model=new Model($debug);
echo " | CREADO.<BR>";
//muestraArbol();
reinicia();
//muestraArbol();
$model->initializeStruct(false);
$model->loadXML("esquemafinal.xml");
//$model->printArraysXML();

$model->loadStructure(true);

$groupelement = new GroupHandler($model);

muestraArbol();

$debugg = false;

echo "<br><br>-----creacion de usuarios <br><br>";
//insertamos los usuarios

$groupelement->insertUser("PEDRITO1",$debugg);
$groupelement->insertUser("PEDRITO2",$debugg);
$groupelement->insertUser("PEDRITO3",$debugg);
$groupelement->insertUser("PEDRITO4",$debugg);
$groupelement->insertUser("PEDRITO5",$debugg);
$groupelement->insertUser("PEDRITO6",$debugg);

echo "<br><br>-----fin de creacion de usuarios <br><br>";
//creamos unos cursos


echo "<br><br>-----creacion de cursos <br><br>";

$model->insertElement('CURSO', "CURSILLO1",$debugg);
$model->insertElement('CURSO', "CURSILLO2",$debugg);
$model->insertElement('CURSO', "CURSILLO3",$debugg);
$model->insertElement('CURSO', "CURSILLO4",$debugg);
$model->insertElement('CURSO', "CURSILLO51",$debugg);

echo "<br><br>-----fin de creacion de cursos <br><br>";


echo "<br><br>----- creacion de grupos <br><br>";
$groupelement->createGroup("migrupo1-CURSILLO1","CURSILLO1",$debugg);
$groupelement->createGroup("migrupo2-CURSILLO1","CURSILLO1",$debugg);
$groupelement->createGroup("migrupo3-CURSILLO1","CURSILLO1",$debugg);
$groupelement->createGroup("migrupo4-CURSILLO1","CURSILLO1",$debugg);
$groupelement->createGroup("migrupo5-CURSILLO1","CURSILLO1",$debugg);

$groupelement->createGroup("migrupo1-CURSILLO2","CURSILLO2",$debugg);
$groupelement->createGroup("migrupo2-CURSILLO2","CURSILLO2",$debugg);
$groupelement->createGroup("migrupo3-CURSILLO2","CURSILLO2",$debugg);
$groupelement->createGroup("migrupo4-CURSILLO2","CURSILLO2",$debugg);
$groupelement->createGroup("migrupo5-CURSILLO2","CURSILLO2",$debugg);

echo "<br><br>-----fin de creacion de grupos <br><br>";


echo "<br><br>----- creacion de actividades <br><br>";

$model->insertElement('ACTIVIDAD', "ACTIVIDAD1",$debugg);
$model->insertElement('ACTIVIDAD', "ACTIVIDAD2",$debugg);
$model->insertElement('ACTIVIDAD', "ACTIVIDAD3",$debugg);
$model->insertElement('ACTIVIDAD', "ACTIVIDAD4",$debugg);
$model->insertElement('ACTIVIDAD', "ACTIVIDAD5",$debugg);

echo "<br><br>----- fin creacion de actividades <br><br>";


echo "<br><br>----- creacion de tutores <br><br>";

$groupelement->insertTutor("tutor1", $debugg);
$groupelement->insertTutor("tutor2", $debugg);
$groupelement->insertTutor("tutor3", $debugg);
$groupelement->insertTutor("tutor4", $debugg);
$groupelement->insertTutor("tutor5", $debugg);

echo "<br><br>----- fin de creacion de tutores <br><br>";

$groupelement->setTutorInGroup("tutor1", "migrupo1-CURSILLO1", "CURSILLO1", false);
$groupelement->setTutorInGroup("tutor2", "migrupo1-CURSILLO1", "CURSILLO1", false);
$miarray = $groupelement->getTutorsInGroup("migrupo1-CURSILLO1", "CURSILLO1");


$model->createRelation("USUARIO-1/ACTIVIDAD-32",$debugg);
$model->createRelation("USUARIO-2/ACTIVIDAD-32",$debugg);
$model->createRelation( "USUARIO-3/ACTIVIDAD-32",$debugg);

$model->createRelation( "USUARIO-1/ACTIVIDAD-33",$debugg);
$model->createRelation("USUARIO-2/ACTIVIDAD-33",$debugg);
$model->createRelation("USUARIO-3/ACTIVIDAD-33",$debugg);

DB::query("INSERT INTO  pru_block_modulo_control_tutorial_data VALUES (44,4,1);");
DB::query("INSERT INTO  pru_block_modulo_control_tutorial_data VALUES (44,5,1);");

DB::query("INSERT INTO  pru_block_modulo_control_tutorial_data VALUES (32,15,1);");
DB::query("INSERT INTO  pru_block_modulo_control_tutorial_data VALUES (33,15,1);");
DB::query("INSERT INTO  pru_block_modulo_control_tutorial_data VALUES (34,15,0);");

DB::query("INSERT INTO  pru_block_modulo_control_tutorial_data VALUES (32,16,'simple');");
DB::query("INSERT INTO  pru_block_modulo_control_tutorial_data VALUES (33,16,'simple2');");
DB::query("INSERT INTO  pru_block_modulo_control_tutorial_data VALUES (34,16,'simple');");

DB::query("INSERT INTO  pru_block_modulo_control_tutorial_data VALUES (32,17,'simple');");
DB::query("INSERT INTO  pru_block_modulo_control_tutorial_data VALUES (33,17,'simple3');");
DB::query("INSERT INTO  pru_block_modulo_control_tutorial_data VALUES (34,17,'simple');");


foreach ($miarray as $elemento){
    echo "elementos devueltos:".$elemento."<br>";
}

$miarray = $model->getAllNodes("/SISTEMA/ACTIVIDAD",true);

//$miarray = $groupelement->getAllGroupsFromCourse("CURSILLO1",true);
//
foreach ($miarray as $element) echo $element."<br>";
$miarray = $model->getAllNodes("/SISTEMA/USUARIO-ACTIVIDAD",false);

//$miarray = $groupelement->getAllGroupsFromCourse("CURSILLO1",true);
//
foreach ($miarray as $element) echo $element."<br>";



echo "<br>  comienza el borrado de la actividad<br>";



//$miarray = $model->getElementsByType("USUARIO");
//foreach ($miarray as $element) echo $element."<br>";
echo "<br> --- ahora -- <br>";

$minuevoarray = $model->getValuesFromPath("/SISTEMA/ACTIVIDAD/TIPO", false);

foreach ($minuevoarray as $element) echo $element."<br>";

//$groupelement->deleteActividad("ACTIVIDAD1",TRUE);
//$groupelement->deleteActividad("ACTIVIDAD2",TRUE);
//$groupelement->deleteActividad("ACTIVIDAD3",TRUE);
//$groupelement->deleteActividad("ACTIVIDAD4",TRUE);
//$groupelement->deleteActividad("ACTIVIDAD5",TRUE);
//    $h=$model->insertElement('GRUPO', "GRUPOA",false);
//    if($h<1) echo "UUUUUUUY6";
//    $h=$model->insertElement('GRUPO', "GRUPOB",false);
//    if($h<1) echo "UUUUUUUY6";

//    $id1=$model->insertElement('SAL',"SAL1");
//    $id2=$model->insertElement('GLO',"GLO1");
//    $id3=$model->insertElement('SER',"SER1");
//
//    $id4=$model->insertElement('SAL',"SAL2");
//    $id5=$model->insertElement('GLO',"GLO2");
//    $id6=$model->insertElement('SER',"SER2");
//
//    $id7=$model->insertElement('SAL',"SAL3");
//    $id8=$model->insertElement('GLO',"GLO3");
//    $id9=$model->insertElement('SER',"SER3");
//
//    $id10=$model->insertElement('SAL',"SAL4");
//    $id11=$model->insertElement('GLO',"GLO4");
////    $id12=$model->insertElement('SER',"SER4");
//////obligatorio

//
//
////escala
//DB::query("INSERT INTO  pru_block_modulo_control_tutorial_data VALUES (7,16,'simple');");
//DB::query("INSERT INTO  pru_block_modulo_control_tutorial_data VALUES (8,16,'simple');");
//DB::query("INSERT INTO  pru_block_modulo_control_tutorial_data VALUES (9,16,'nosimple');");
//
////tipo
//DB::query("INSERT INTO  pru_block_modulo_control_tutorial_data VALUES (7,17,'foro');");
//DB::query("INSERT INTO  pru_block_modulo_control_tutorial_data VALUES (8,17,'foro');");
//DB::query("INSERT INTO  pru_block_modulo_control_tutorial_data VALUES (9,17,'tarea');");
//
////
//
//
////$groupelement->insertUserInGroup("PEDRITO2","migrupo","CURSILLO1");
//$groupelement->insertUserInGroup("JOSITO","migrupo","CURSILLO1");
//$groupelement->insertUserInGroup("MANOLITO","migrupo","CURSILLO1");
//
////
////
////echo "juajuajuajua";
//echo "<br>";
//
//$groupelement->insertTutor("mitutor1", $debug);
//$groupelement->insertTutor("mitutor2", $debug);
//
//$groupelement->setTutorInGroup("mitutor1","migrupo","CURSILLO1",false);
//echo "asdadsads";
//$groupelement->setTutorInGroup("mitutor2","migrupo1","CURSILLO1",false);
//
//$newarray =  $groupelement->getTutorsFromCourse("CURSILLO1");
//$array22 = $groupelement->getGroupsFromTutor("mitutor1",true,"CURSILLO1");
//foreach ($newarray as $elemento) {
//    echo "elementos devueltos:".$elemento."<br>";

//$newarray =  $groupelement->getTutorsFromCourse("CURSILLO1");




//$arrayCosas = array();
//
//$arrayCosas[]=new queryHandler("/CURSO-GRUPO/TUTOR","=","PEDRITO");
//
//
////$arrayCosas[]=new queryHandler("/ACTIVIDAD/ESCALA","=","nosimple");
//
////$arrayCosas[]=new queryHandler("/ACTIVIDAD/TIPO","=","tarea");
//
//$miarray = $model->getIdsByProperty($arrayCosas,true);
//
//foreach ($newarray as $elemento){
//    echo "elementos devueltos:".$elemento."<br>";
//}

//echo "<br><br> BLABLABLALBLA <br><br>";

//$groupelement->removeGroup("migrupo","CURSILLO1",false);
//
//
//
// $model->createRelation('CURSO-CURSILLO1/GRUPO-GRUPOA',$debug);
//    $model->createRelation('USR-1/SAL-'.$id1,$debug);
//    $model->createRelation('USR-2/GLO-'.$id2,$debug);
//    $model->createRelation('USR-3/RSC-4/GLO-'.$id2,$debug);
//    $model->createRelation('USR-3/RSC-4/SAL-'.$id1,$debug);
//    $model->createRelation('USR-3/RSC-4/SER-'.$id3,$debug);
//    $model->createRelation('SAL-'.$id1.'/RSC-4/USR-1',$debug);
//    $model->createRelation('USR-1/RSC-4/GLO-'.$id2.'/SAL-'.$id1,$debug);
//    $model->createRelation('USR-1/RSC-4/GLO-'.$id2.'/SER-'.$id3,$debug);
//    $model->createRelation('USR-1/RSC-4/SAL-'.$id1.'/SER-'.$id3,$debug);
//    $model->createRelation('GLO-'.$id2.'/SAL-'.$id1.'/SER-'.$id3.'/USR-1',$debug);
//    $model->createRelation('GLO-'.$id2.'/SAL-'.$id1.'/SER-'.$id3.'/USR-1/RSC-4',$debug);
//
//
//
//    $h=$model->createRelation("USR-1/RSC-4",true);
//    if($h<1) echo "UUUUUUUY7";
//    $h=$model->createRelation("USR-1/RSC-5",true);
//    if($h<1) echo "UUUUUUUY8";
//    $h=$model->createRelation("USR-1/RSC-5",true);
//    if($h<1) echo "UUUUUUUY9";
//    $h=$model->createRelation("USR-2/RSC-6",true);
//    if($h<1) echo "UUUUUUUY10";
//    $h=$model->createRelation("USR-3/RSC-6",true);
//    if($h<1) echo "UUUUUUUY11";
//    $h=$model->createRelation("USR-4/RSC-5",true);
//    if($h<1) echo "UUUUUUUY12";
//    $h=$model->createRelation("USR-1324/RSC-3244",true);
//    if($h<1) echo "UUUUUUUY13";
//
//    $h=$model->setValue("/RSC-4/CATEGORIZACION/ENTORNO_PROFESIONAL/SECTOR","valor1",false);
//    if($h<1) echo "UUUUUUUY14";
//    $h=$model->setValue("/RSC-5/CATEGORIZACION/ENTORNO_PROFESIONAL/SECTOR","valor2",false);
//    if($h<1) echo "UUUUUUUY15";
//    $h=$model->setValue("/RSC-6/CATEGORIZACION/ENTORNO_PROFESIONAL/SECTOR","valor3",false);
//    if($h<1) echo "UUUUUUUY16";
//    $h=$model->setValue("/RSC-1/CATEGORIZACION/ENTORNO_PROFESIONAL/SECTOR","valor3",false);
//    if($h<1) echo "UUUUUUUY17";
//    $h=$model->setValue("/RSC-125/CATEGORIZACION/ENTORNO_PROFESIONAL/SECTOR","valor3",false);
//    if($h<1) echo "UUUUUUUY18";
//
//
//
//    $h=$model->setValue("/USR-1/LOGIN/PASSWORD","valor1",false);
//    if($h<1) echo "UUUUUUUY19";
//    $h=$model->setValue("/USR-2/LOGIN/PASSWORD","valor1",false);
//    if($h<1) echo "UUUUUUUY20";
//    $h=$model->setValue("/USR-3/LOGIN/PASSWORD","valor1",false);
//    if($h<1) echo "UUUUUUUY21";
//    $h=$model->setValue("/USR-4/LOGIN/PASSWORD","valor1",false);
//    if($h<1) echo "UUUUUUUY22";
//    $h=$model->setValue("/USR-185/LOGIN/PASSWORD","valor1",false);
//    if($h<1) echo "UUUUUUUY23";
//
//
//    $h=$model->setValue("/USR-1/RSC-5/NOTA","valor1",false);
//    if($h<1) echo "UUUUUUUY24";
//    $h=$model->setValue("/USR-3/RSC-6/NOTA","valor1",false);
//    if($h<1) echo "UUUUUUUY25";
//    $h=$model->setValue("/USR-4/RSC-5/NOTA","valor1",false);
//    if($h<1) echo "UUUUUUUY26";
//
////
//
//
//
//
//    $buscar="USR-?/RSC-?";
//    $r=$model->getRelation($buscar);
//    echo "<BR>Buscando $buscar <BR>";
//    foreach ($r as $r1) {
//        echo "$r1 <BR>";
//    }
//    $buscar="USR-1/RSC-?";
//    $r=$model->getRelation($buscar);
//    echo "Buscando $buscar <BR>";
//    foreach ($r as $r1) {
//        echo "$r1 <BR>";
//    }
//    $buscar="GLO-?/SAL-?/SER-?";
//    $r=$model->getRelation($buscar);
//    echo "Buscando $buscar <BR>";
//    foreach ($r as $r1) {
//        echo "$r1 <BR>";
//    }
//    $buscar="GLO-8/SAL-?/SER-9/USR-?/RSC-4";
//    $r=$model->getRelation($buscar);
//    echo "Buscando $buscar <BR>";
//    foreach ($r as $r1) {
//        echo "$r1 <BR>";
//    }






//$arrayCosas = array();
//
//$arrayCosas[]=new queryHandler("/ACTIVIDAD/OBLIGATORIO","=","0");
//
//
//$arrayCosas[]=new queryHandler("/ACTIVIDAD/ESCALA","=","nosimple");
//
//$arrayCosas[]=new queryHandler("/ACTIVIDAD/TIPO","=","tarea");
//
//$miarray = $model->getIdsByProperty($arrayCosas,true);
//
//echo "adad";
//
//foreach ($miarray as $elemento){
//    echo "elementos devueltos:".$elemento."<br>";
//}

dB::close($link);

?>